﻿#region Using

using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Asah.SiteWorx.BlogEngine.Core;

#endregion

public partial class Blog_Widgets_RecentComments_Edit : WidgetEditBase
{
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            StringDictionary settings = GetSettings();
            if (settings.ContainsKey("numberofcomments"))
                txtNumberOfPosts.Text = settings["numberofcomments"];
            else
                txtNumberOfPosts.Text = "10";
        }
    }

    public override void Save()
    {
        StringDictionary settings = GetSettings();
        settings["numberofcomments"] = txtNumberOfPosts.Text;
        SaveSettings(settings);
        HttpRuntime.Cache.Remove("widget_recentcomments");
    }
}
